home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Programming / ace_gpl_release / prgs / misc / fact.b < prev    next >
Encoding:
Text File  |  1996-08-28  |  249 b   |  16 lines

  1. '...Recursive factorial.
  2.  
  3. Defsng f,n,x
  4.  
  5. Sub fact(n)
  6.   If n<2 Then fact=1 Else fact=n*fact(n-1)
  7. End Sub
  8.  
  9. Repeat
  10.   Print
  11.   Repeat
  12.     Input "Enter an integer (0 or higher, -1 to stop): ",x
  13.   Until x>=-1
  14.   If x<>-1 Then Print "-->>";fact(x)
  15. Until x=-1
  16.